Repository navigation
Migrate money request distance, manual distance and rate steps to dyn… - #97780
mjasikowski merged 5 commits into
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
…amic routes Replaces the static MONEY_REQUEST_STEP_DISTANCE, MONEY_REQUEST_STEP_DISTANCE_MANUAL and MONEY_REQUEST_STEP_DISTANCE_RATE routes with the `expense-distance`, `expense-distance-manual` and `expense-distance-rate` dynamic suffixes, following the MONEY_REQUEST_STEP_TAX_RATE pattern: the legacy path params become query params of the suffix and back navigation is derived with useDynamicBackPath. The distance and manual distance pages are still mounted on the static create screens, so `backTo` stays undefined there and the create wizard keeps its forward navigation. Adds OldRoutes redirects for the three legacy paths and covers them with unit tests in getMatchingNewRouteTest.
61a3610 to
e1b984b
Compare
The `createDynamicRoute` / `DYNAMIC_ROUTES` imports were dropped while amending the config.ts tab-host fix, breaking the TypeScript build. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0918ca7a0c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-08-10.at.14.11.29.mp4 |
|
Note An issue where editing the odometer sometimes shows 'not found'—and reloading redirects to an invalid route—is out of scope for this migration. This is also currently happening on the latest staging Page not found & wrong navigationCleanShot.2026-08-10.at.17.59.04.1.mp4CleanShot.2026-08-10.at.18.02.59.2.mp4I'll troubleshoot and report the existing bug after finishing this PR soon |
|
@suneox conflicts |
The conflicts have been resolved |
|
@suneox please resolve the conflicts |
…-request-part-2-suneox
The conflicts have been resolved |
|
This PR is ready for merge |
|
🚧 mjasikowski has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/mjasikowski in version: 9.4.55-0 🚀
|
Help site review — no changes requiredI reviewed the changes in this PR and no updates to Expensify's help site files ( Why: This is an internal navigation/routing refactor. It migrates the distance, manual distance, and rate money-request steps from legacy Scope checked:
Since there are no user-facing changes, I did not create a draft help site PR. |
|
@suneox @mjasikowski @huult Bug7236024_1787026970973.Migr10.mp4 |
@m-natarajan The
|
|
Here is test case 3.5: CleanShot.2026-08-18.at.20.06.18.1.mp4ProdCleanShot.2026-08-18.at.20.07.24.2.mp4 |
|
@suneox Noted, Thanks |
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.4.55-4 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Fixed Issues
$ #83851
PROPOSAL:
Tests
DYNAMIC_ROUTES.MONEY_REQUEST_STEP_DISTANCE— edit waypoints (expense-distance)Case 1.1 — Confirmation page → Distance field
Target: src/components/MoneyRequestConfirmationList/sections/DistanceField.tsx#L74
Precondition: you are on the Confirmation step of a waypoint-based distance expense (not manual / odometer / GPS).
Steps:
<base>/expense-distance?action=create&iouType=submit&transactionID=<txn>&reportID=<report>and the waypoint page opens.Case 1.2 — Expense details → Distance field
Target: src/components/ReportActionItem/MoneyRequestView.tsx#L985
Precondition: a submitted, unsettled distance expense.
Steps:
/r/<id>)./r/<id>/expense-distance?action=edit&iouType=submit&transactionID=<txn>&reportID=<id>./r/<id>with the updated distance.Case 1.3 — Waypoint edit reuses the dynamic URL as its
backTo(GH #90037)Target: src/pages/iou/request/step/DynamicIOURequestStepDistance.tsx#L382 — now
createDynamicRoute(suffix.getRoute(...), backPath)Steps:
?backTo=<encoded dynamic URL>— the encoded value must containexpense-distanceand theaction/iouType/transactionID/reportIDquery./not-found, and the RHP is not torn down (this is the bug [Due for payment 2026-05-20] [Due for payment 2026-05-18] Split distance - App crashes when clicking RHP back button on waypoints editor #90037 the explicit base guards against).Case 1.4 — The create wizard is unaffected (dual-screen
MONEY_REQUEST.CREATE)Target: src/pages/iou/request/IOURequestStartPage.tsx#L322
Steps:
/create/submit/start/<txn>/<report>/distance— noexpense-distancesuffix.backToisundefinedon the static screen.Case 1.5 — Split expense edit → Distance field
Target: src/pages/iou/SplitExpenseEditPage.tsx#L252
Steps:
<split-edit base>/expense-distance?action=edit&iouType=split-expense&transactionID=<OPTIMISTIC_DISTANCE_SPLIT_TRANSACTION_ID>&reportID=<reportID>.Case 1.6 — Refresh / deep link
Steps:
/r/<id>/expense-distance?..., press F5./r/<id>restored underneath./r/<id>.Case 1.7 — Legacy URL redirect
Target: OldRoutes —
'/*/*/distance/*/*'Steps:
https://dev.new.expensify.com:8082/edit/submit/distance/<transactionID>/<reportID>and hit Enter./r/<reportID>/expense-distance?action=edit&iouType=submit&transactionID=<transactionID>&reportID=<reportID>.?backTo=loses its query — same known trade-off as thetaxRateredirect onmain. Not a failure.DYNAMIC_ROUTES.MONEY_REQUEST_STEP_DISTANCE_MANUAL— manual distance entry (expense-distance-manual)Case 2.1 — Confirmation page → Distance field (manual distance)
Target: src/components/MoneyRequestConfirmationList/sections/DistanceField.tsx#L65
Precondition: the expense is a manual distance expense (a typed distance, no waypoints).
Steps:
<base>/expense-distance-manual?action=create&iouType=submit&transactionID=<txn>&reportID=<report>.Case 2.2 — Expense details → Distance field (manual)
Target: src/components/ReportActionItem/MoneyRequestView.tsx#L973
Steps:
/r/<id>)./r/<id>/expense-distance-manual?action=edit&iouType=submit&transactionID=<txn>&reportID=<id>./r/<id>with the updated value./r/<id>.Case 2.3 — Split expense edit → Distance field (manual)
Target: src/pages/iou/SplitExpenseEditPage.tsx#L239
Steps:
<split-edit base>/expense-distance-manual?action=edit&iouType=split-expense&transactionID=<OPTIMISTIC_TRANSACTION_ID>&reportID=<reportID>.Case 2.4 — The distance-create wizard is unaffected (dual-screen
DISTANCE_CREATE)Target: src/pages/iou/request/DistanceRequestStartPage.tsx#L152
Steps:
.../distance-manual) with noexpense-distance-manualsuffix.Case 2.5 — Refresh / deep link and legacy URL redirect
Steps:
/r/<id>/expense-distance-manual?..., press F5 → Expected: the stack is restored correctly.https://dev.new.expensify.com:8082/edit/submit/distance-manual/<txn>/<report>→ Expected: it redirects to/r/<report>/expense-distance-manual?action=edit&iouType=submit&transactionID=<txn>&reportID=<report>.distance-manualpath is not swallowed by the'/*/*/distance/*/*'pattern — the segment must matchdistance-manualexactly.DYNAMIC_ROUTES.MONEY_REQUEST_STEP_DISTANCE_RATE— pick a distance rate (expense-distance-rate)Case 3.1 — Confirmation page → Rate field
Target: src/components/MoneyRequestConfirmationList/sections/RateField.tsx#L140
Precondition: the workspace has ≥2 enabled distance rates.
Steps:
<base>/expense-distance-rate?action=create&iouType=submit&transactionID=<txn>&reportID=<report>and the rate list opens.Case 3.2 — Expense details → Rate field
Target: src/components/ReportActionItem/MoneyRequestView.tsx#L1043
Steps:
/r/<id>) on a workspace with ≥2 rates./r/<id>/expense-distance-rate?action=edit&iouType=submit&transactionID=<txn>&reportID=<id>./r/<id>with the rate updated.Case 3.3 — Track expense in self-DM → Set default workspace before the rate step
Target: src/components/ReportActionItem/MoneyRequestView.tsx#L1029 — the dynamic route is nested inside
SET_DEFAULT_WORKSPACEPrecondition: a distance track expense in self-DM where the user has paid workspaces but no default one (
shouldSelectPolicy === true, no policy).Steps:
expense-distance-rateplus theaction/iouType/transactionID/reportIDquery..../expense-distance-rate?...), not/not-found.Case 3.4 — Split expense edit → Rate field
Target: src/pages/iou/SplitExpenseEditPage.tsx#L272
Steps:
<split-edit base>/expense-distance-rate?action=edit&iouType=split-expense&transactionID=<OPTIMISTIC_TRANSACTION_ID>&reportID=<reportID>.Case 3.5 — Creating a rate through Upgrade returns to the rate step
Target: src/pages/workspace/distanceRates/CreateDistanceRatePage.tsx#L90 — now
createDynamicRoute(..., ROUTES.REPORT_WITH_ID.getRoute(reportID))Precondition: a distance expense on a workspace without Distance rates enabled, so tapping Rate goes through the Upgrade screen (
action === edit).Steps:
/r/<reportID>/expense-distance-rate?action=edit&iouType=submit&transactionID=<txn>&reportID=<reportID>with the new rate selected — not/not-found, not the workspace settings.action === create(from Confirmation) → Expected: you return to Confirmation, unchanged frommain.Case 3.6 — Refresh / deep link and legacy URL redirect
Steps:
/r/<id>/expense-distance-rate?..., press F5 → Expected: the stack is restored and Back lands on/r/<id>.https://dev.new.expensify.com:8082/edit/submit/distanceRate/<txn>/<report>→ Expected: it redirects to/r/<report>/expense-distance-rate?action=edit&iouType=submit&transactionID=<txn>&reportID=<report>.Case 3.7 —
entryScreensblocks an invalid baseSteps:
https://dev.new.expensify.com:8082/settings/profile/expense-distance-rate?action=edit&iouType=submit&transactionID=1&reportID=2and hit Enter.Offline tests
QA Steps
Test case 1: Edit the manual distance of a new expense (Confirmation)
/expense-distance-manual?action=create&iouType=submit&transactionID=…&reportID=….Test case 2: Pick a distance rate on a new expense (Confirmation)
/expense-distance-rate?action=create&iouType=submit&transactionID=…&reportID=…and the rate list opens.Test case 3: Distance-create wizard keeps the static URL (Manual tab)
.../distance-manual) with noexpense-distance-manualsuffix.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
MacOS: Chrome / Safari
CleanShot.2026-08-10.at.12.08.49.1.mp4
Case 1.1 — Confirmation → Distance
On video
Case 1.2 — Expense view → Distance
On video
Case 1.3 — Waypoint edit → Back (#90037)
Case 1.4 — Create wizard (CREATE) no suffix
On video
Case 1.5 — Split → Distance
Case 1.6 — Refresh/deep-link (expense-distance)
Case 1.7 — Legacy URL redirect (distance)
On video
Case 2.1 — Confirmation → Distance (manual)
Case 2.2 — Expense view → Distance (manual)
Case 2.3 — Split → Distance (manual)
Case 2.4 — Distance-create wizard Manual tab (no suffix)
Case 2.5 — Refresh + redirect (distance-manual)
Case 3.1 — Confirmation → Rate
Case 3.2 — Expense view → Rate
Case 3.3 — Track → Set default workspace → Rate
On video
Case 3.4 — Split → Rate
Case 3.5 — Upgrade → Create rate → dynamic
Case 3.6 — Refresh + redirect (distance-rate)
On video
Case 3.7 — entryScreens blocks invalid base
On video
Case 4.1 — Odometer/GPS/tabs unchanged
Case 4.2 — Offline
Android Native
Android mWeb
iOS Native
CleanShot.2026-08-10.at.18.14.49.1.mp4
iOS mWeb